<?php

namespace app\admin\model;

use think\Model;

class Paper extends Model
{
    protected $type = [
        'attr_files' => 'json',
        'paper_pics' => 'json',
        'pics' => 'json',
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function getClassNameAttr($key, $item)
    {
        $types = [1 => '管综', 2 => '英语'];
        $paperType = [1=>'论证有效性分析', 2 => '论说文', 3=>'大作文', 4=> '小作文'];
        $subJectType = [1 => '历年真题', 2=> '模考题'];
        return  ($types[$item['type']] ?? '') . '-' .  ($paperType[$item['paper_type']] ?? '') .'-'. ($subJectType[$item['subject_type']]  ?? '');
    }
}
